package com.ac.api.user.Enum;

public enum PicStyle {
    ADMIN(1, "admin"),
    PHONEUSER(2, "phoneUser"),
    WXUSER(3, "wxUser");

    private final int styleCode;
    private final String styleName;

    PicStyle(int styleCode, String styleName) {
        this.styleCode = styleCode;
        this.styleName = styleName;
    }

    public int getStyleCode() {
        return styleCode;
    }

    public String getStyleName() {
        return styleName;
    }

    // 从整数获取枚举值
    public static PicStyle fromStyleCode(int styleCode) {
        for (PicStyle style : values()) {
            if (style.getStyleCode() == styleCode) {
                return style;
            }
        }
        throw new IllegalArgumentException("Invalid style code: " + styleCode);
    }

    // 从字符串获取枚举值
    public static PicStyle fromStyleName(String styleName) {
        for (PicStyle style : values()) {
            if (style.getStyleName().equalsIgnoreCase(styleName)) {
                return style;
            }
        }
        throw new IllegalArgumentException("Invalid style name: " + styleName);
    }
}
